New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-42228] - Prevent JavaScript error on the Jenkins system configuration page #4889
Conversation
@@ -500,7 +500,11 @@ var tooltip; | |||
//======================================================== | |||
// using tag names in CSS selector makes the processing faster | |||
function registerValidator(e) { | |||
e.targetElement = findFollowingTR(e, "validation-error-area").firstChild.nextSibling; | |||
var tr = findFollowingTR(e, "validation-error-area"); | |||
if (!tr || !tr.firstChild) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a warning?
if (!tr || !tr.firstChild) { | |
if (!tr || !tr.firstChild) { | |
console.warn("Couldn't register validator, start element was", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good to me I probably wouldn’t call it a violation.
And would reword the changelog too.
Prevent JavaScript error when registering validators in some cases?
@timja |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good as a workaround 👍
We may merge it in 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for catching the bug 😅
Thanks a lot for you contributions @takashiharano ! |
See JENKINS-42228.
This is a workaround for TypeError by handling undefined object on the Jenkins system configuration page.
The error still occurs in Jenkins 2.250.
Manage Jenkins > Configure Ststem
The permanent solution is probably to fix the HTML structure or something.
I tried to investigate the root cause, but it seems to be a timing problem and a little bit hard to figure out.
Even so, this workaround would not take a change for the worse.
Here is the error details for further investigation.
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgradeDesired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge
:Proposed changelog entries
are correctupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).